<?php $this; /* @var $this \Comm\View */  ?>
<?php $this->_block('content'); ?>

<div class="panel panel-info">
	<div class="panel-body">
		<a href="<?= $this->path('manage/article/create') ?>" class="btn btn-info" role="button"><?= _('发表文章')?></a>
	</div>
</div>

<?php if(!empty($articles['result'])) : ?>
<form id="form-manage-category-result" action="<?= $this->path('aj/manage/category/destroy') ?>" class="form-inline" method="post" onsubmit="return false">
<div class="panel panel-default">
	<table class="table table-hover table-bordered">
		<thead>
			<tr>
				<th width="100" class="text-center">ID</th>
				<th width="130" class="text-center"><?= _('分类') ?></th>
				<th class="text-center"><?= _('标题') ?></th>
				<th width="100" class="text-center"><?= _('状态') ?></th>
				<th width="150" class="text-center"><?= _('发表时间') ?></th>
				<th width="160" class="text-center"><?= _('发布时间') ?></th>
				<th width="140" class="text-center"><?= _('操作') ?></th>
			</tr>
		</thead>
		<tbody>
			<?php foreach($articles['result'] as $value) : ?>
			<tr data-id="<?= $value['id'] ?>">
				<td class="text-center"><?= $value['id'] ?></td>
				<td class="text-center"><?= $categorys[$value['category_id']]['name'] ?></td>
				<td><?= $value['title'] ?></td>
				<td class="text-center"><?= _(\Model\Article::showStateName($value['state'])) ?></td>
				<td class="text-center"><?= $value['create_time'] ?></td>
				<td class="text-center"><a target="_blank" href="<?= $blog_url ?>/article/<?= $value['id'] ?>.html"><?= $value['publish_time'] ?></a></td>
				<td class="text-center">
					<a href="javascript:void(0);" action-type="publish" class="btn btn-xs btn-default" role="button"><?= _('发布') ?></a>
				    <a href="<?= $this->path("manage/article/edit?id={$value['id']}") ?>" class="btn btn-xs btn-default" role="button"><?= _('编辑') ?></a>
				    <a href="javascript:void(0);" action-type="delete" class="btn btn-xs btn-danger" role="button"><?= _('删除') ?></a>
				</td>
			</tr>
			<?php endforeach; ?>
		</tbody>
	</table>
	<div class="panel-footer"><?= $this->_include('_inc/pager', ['pager' => $pager]) ?></div>
</div>
</form>
<?php endif; ?>


<?php $this->_blockEnd(); ?>
<?php $this->_block('body_end')?>
<?php $this->js('manage/article/index.js'); ?>
<?php $this->_blockEnd()?>
<?php $this->_blockLoad('_block/manage', ['nav'=>'article']) ?>